package com.controller;

import com.anno.FrontLogin;
import com.controller.base.BaseFrontController;
import com.controller.base.Response;
import com.model.FrontUser;
import com.service.JobCollectService;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.constraints.NotNull;

@RestController
@RequestMapping("/jobCollect")
@Api("前端职位收藏接口")
public class JobCollectController extends BaseFrontController {

    @Resource
    private JobCollectService service;

    @FrontLogin
    @PostMapping("/collect")
    public Response collect(@NotNull Long jobId) {
        FrontUser user = getUser();
        service.collect(user.getId(), jobId);
        return success();
    }
}
